<?php



// todo : ajouter le fichier au fil



/*

    auteur : zulad

    date : 27/11/2012
	
	Update by infoxp
	date : 28/12/2012

*/



$cat['Sondages']['txt']='Sondages';

$cat['News']['txt']='News';

$cat['Tutos']['txt']='Tutos';

$cat['Cours']['txt']='Cours';



// lien

$cat['Sondages']['lnk']='sondages';

$cat['News']['lnk']='news';

$cat['Tutos']['lnk']='tuto';

$cat['Cours']['lnk']='cours';


// count

$cat['Sondages']['cpt'] = GetValueFromQuery('SELECT count(*) as value FROM sondage');

$cat['News']['cpt'] = GetValueFromQuery('SELECT count(*) as value FROM news');

$cat['Tutos']['cpt'] = GetValueFromQuery('SELECT count(*) as value FROM tutos');

$cat['Cours']['cpt'] = GetValueFromQuery('SELECT count(*) as value FROM cours');



echo '<h2>La liste</h2>'."";



$database=null;


foreach ($cat  as $k=>$v)

{

    echo '';

}
			// ici on affiche un texte en hut de la page pour le changer c'esty dans modules/message_haut.php
echo '' . Liste . '<br />';


	$query = $pdo->query("SELECT * FROM listes");
	$display = '';
	$totalContent = 0;
	
	if($query->rowCount() > 0){
		while($data = $query->fetch(PDO::FETCH_OBJ)){
			 $display .= '<div class="liste contenu"><div class="titre">'.htmlspecialchars($data->titre).'</div>'

            

            //image

            .'<div class="contenu_images"><a href="'.$data->module.'" title="'.htmlspecialchars($data->info).'"><img src="'.DIR_DESIGN.'/'.getDesignName().'/'.$data->image.'"  class="liste_des_images" alt="" title="" /></a></div>';

            
			 // counter
			$tbl_exist = $pdo->query("SHOW TABLES FROM ".DATABASE." LIKE '".$data->tableModule."'");
			if($tbl_exist->rowCount() > 0){
				$counter = (GetValueFromQuery("SELECT COUNT(*) as value FROM `".$data->tableModule."`")) . ' ' . htmlspecialchars($data->titre);
				$totalContent += $counter;
			}
			else
				$counter = '(Error)';
			
            $display .= '<div class="nombre_tutos">'.$counter.'</div></div>';	
		}
		
		echo '<div class="cadre_transparent">(' . $totalContent . ') Contenue(s)</div>';
		echo $display.'';
	}


?>